home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / hm--html-menus / hm--html-menu.el.z / hm--html-menu.el
Encoding:
Text File  |  1998-05-21  |  28.9 KB  |  862 lines

  1. ;;;  hm--html-menu ---  A menu for the hm--html-mode.
  2. ;;;  
  3. ;;;  $Id: hm--html-menu.el,v 5.9 1997/07/20 06:36:20 muenkel Exp $
  4. ;;;
  5. ;;;  Copyright (C) 1993 - 1997  Heiko Muenkel
  6. ;;;  email: muenkel@tnt.uni-hannover.de
  7. ;;;
  8. ;;;  This program is free software; you can redistribute it and/or modify
  9. ;;;  it under the terms of the GNU General Public License as published by
  10. ;;;  the Free Software Foundation; either version 2, or (at your option)
  11. ;;;  any later version.
  12. ;;;
  13. ;;;  This program is distributed in the hope that it will be useful,
  14. ;;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ;;;  GNU General Public License for more details.
  17. ;;;
  18. ;;;  You should have received a copy of the GNU General Public License
  19. ;;;  along with this program; if not, write to the Free Software
  20. ;;;  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. ;;;
  22. ;;; 
  23. ;;; Description:
  24. ;;;
  25. ;;;    Defines pulldown and popup menus for the html mode (hm--html-mode).
  26. ;;;
  27. ;;;    You should also have the w3 package from William M. Perry, for
  28. ;;;    browsing html- files in the xemacs and the program Xmosaic together
  29. ;;;    with the file html-view.el from Ron Tapia for browsing html- files
  30. ;;;    in the Xmosaic.
  31. ;;; 
  32. ;;; Installation: 
  33. ;;;   
  34. ;;;    Put this file in one of your load path directories.
  35. ;;;
  36. ;;;     Look at the files hm--html-mode.el and hm--html-configuration
  37. ;;;     for further installation points.
  38. ;;;
  39.  
  40. ;;
  41. ;; Menu "HTML"
  42. ;;
  43.  
  44. (defvar hm--html-pulldown-menu nil "*A List with the HTML-Menu.")
  45. (defvar hm--html-menu-region-expert nil "*A List with the HTML-Menu.")
  46. (defvar hm--html-menu-region-novice nil "*A List with the HTML-Menu.")
  47. (defvar hm--html-menu-noregion-expert nil "*A List with the HTML-Menu.")
  48. (defvar hm--html-menu-noregion-novice nil "*A List with the HTML-Menu.")
  49.  
  50. (setq hm--html-menu-noregion-expert
  51.        '("HTML Noregion Expert Menu"
  52.      ("Anchors"
  53.       ["Relative link..." hm--html-add-relative-link t]
  54.       ["General link..." hm--html-add-normal-link t]
  55.       ["Drag & Drop"
  56.        idd-start-mouse-drag-and-drop
  57.        :active t
  58.        :keys "\\[idd-mouse-drag-and-drop]"]
  59.       "----"
  60.       ["Html link..." hm--html-add-html-link t]
  61.       ["Info link..." hm--html-add-info-link t]
  62.       ["Gopher link..." hm--html-add-gopher-link t]
  63.       ["File link..." hm--html-add-file-link t]
  64.       "----"
  65.       ["Ftp link..." hm--html-add-ftp-link t]
  66.       ["News link..." hm--html-add-news-link t]
  67.       ["Mailbox link..." hm--html-add-mail-box-link t]
  68.       ["Mailto link..." hm--html-add-mailto-link t]
  69.       ["Wais link (direct)..." hm--html-add-direct-wais-link t]
  70.       ["Wais link (gateway)..." hm--html-add-wais-link t]
  71.       "----"
  72.       ["Proggate link..." hm--html-add-proggate-link t]
  73.       ["Local Proggate link..." hm--html-add-local-proggate-link t]
  74.       "----"
  75.       ["Link target..." hm--html-add-link-target t]
  76.       )
  77.      ("Frame"
  78.       ["Full html frame..." hm--html-add-full-html-frame t]
  79.       ["Frame template..." 
  80.        (hm--html-insert-template hm--html-frame-template-file)
  81.        (file-exists-p hm--html-frame-template-file)]
  82.       "----"
  83.       ["Doctype" hm--html-add-doctype t]
  84.       ["Html" hm--html-add-html t]
  85.       ["Head" hm--html-add-head t]
  86.       ["Body" hm--html-add-body t]
  87.       "----"
  88.       ["Title and Header..." hm--html-add-title-and-header t]
  89.       ["Title..." hm--html-add-title t]
  90.       ["Header..." hm--html-add-header t]
  91.       ["Address" hm--html-add-address t]
  92.       ["Signature" hm--html-add-signature t]
  93.       "----"
  94.       ["Meta information..." hm--html-add-meta t]
  95.       ["Node Link..." hm--html-add-normal-node-link t]
  96.       ["Isindex..." hm--html-add-isindex t]
  97.       ["Document Base..." hm--html-add-base t]
  98.       "----"
  99.       ["Created comment" hm--html-insert-created-comment t]
  100.       ["Changed comment" hm--html-insert-changed-comment t]
  101.       ["Modified line" hm--html-insert-modified-line t]
  102.       ["New date in title" hm--html-new-date t]
  103.       )
  104.      ("Structure"
  105.       ["Menu or list item" hm--html-add-list-or-menu-item t]
  106.       ["Menu" hm--html-add-menu t]
  107.       ["Unordered list" hm--html-add-list t]
  108.       ["Ordered list" hm--html-add-numberlist t]
  109.       ["Directory list" hm--html-add-directory-list t]
  110.       "----"
  111.       ["Description list" hm--html-add-description-list t]
  112.       ["Description title" hm--html-add-description-title t]
  113.       ["Description entry" hm--html-add-description-entry t]
  114.       ["Description title + entry" 
  115.        hm--html-add-description-title-and-entry t]
  116.       "----"
  117.       ["Table..." hm--html-add-table t]
  118.       ["Table title..." hm--html-add-table-title t]
  119.       ["Table header..." hm--html-add-table-header t]
  120.       ["Table first row..." hm--html-add-first-table-row t]
  121.       ["Table additional row..." hm--html-add-additional-table-row t]
  122.       ("Additional Commands"
  123.        ["Table row frame..." hm--html-add-row-frame t]
  124.        ["Table header entry..." hm--html-add-header-entry t]
  125.        ["Table row entry..." hm--html-add-row-entry t]
  126.        ["Span columns..." hm--html-table-add-colspan-attribute t]
  127.        ["Span rows..." hm--html-table-add-rowspan-attribute t]
  128.        )
  129.       "----"
  130.       ["Paragraph container" hm--html-add-paragraph t]
  131.       ["Paragraph start tag" hm--html-add-paragraph-separator t]
  132.       ["Document division" hm--html-add-document-division t]
  133.       ["New line" hm--html-add-line-break t]
  134.       ["Horizontal rule" hm--html-add-horizontal-rule t]
  135.       )
  136.      ("Formatting Paragraphs"
  137. ;      ["Without links" hm--html-add-plaintext t]
  138.       ["Preformatted" hm--html-add-preformatted t]
  139.           ["Blockquote" hm--html-add-blockquote t]
  140.       "----"
  141.       ["Basefont..." hm--html-add-basefont t]
  142.       ["Font..." hm--html-add-font t]
  143.       ["Center" hm--html-add-center t]
  144.       ["Style" hm--html-add-style t]
  145.       "----"
  146.       ["HTML Comment" hm--html-add-comment t]
  147. ;      ["Listing" hm--html-add-listing t]
  148. ;      ["Abstract" hm--html-add-abstract t]
  149.       )
  150.      ("Formatting Words"
  151.       ["Bold" hm--html-add-bold t]
  152.       ["Italic" hm--html-add-italic t]
  153.           ["Typewriter" hm--html-add-fixed t]
  154.       ["Small" hm--html-add-small t]
  155.       ["Big" hm--html-add-big t]
  156.       ["Superscript" hm--html-add-superscript t]
  157.       ["Subscript" hm--html-add-subscript t]
  158.       "----"
  159.       ["Underline" hm--html-add-underline t]
  160.       ["Strikethru" hm--html-add-strikethru t]
  161.       "----"
  162. ;          ["Emphasized" hm--html-add-emphasized t]
  163. ;          ["Strong" hm--html-add-strong t]
  164. ;       "----"
  165.       ("Phrase"
  166.        ["Emphasized" hm--html-add-emphasized t]
  167.        ["Strong" hm--html-add-strong t]
  168.        "----"
  169.        ["Definition" hm--html-add-definition t]
  170.        ["Keyboard" hm--html-add-keyboard t]
  171.        ["Variable" hm--html-add-variable t]
  172.        ["Code" hm--html-add-code t]
  173.        ["Sample" hm--html-add-sample t]
  174.        ["Citation" hm--html-add-citation t]
  175.        )
  176. ;; All the following commands are still implemented, but most
  177. ;; of them are not defined in HTM 3.2
  178. ;; You've to load hm--html-not-standard.el to use them
  179. ;      ("Computing"
  180. ;       ["Definition" hm--html-add-definition t]
  181. ;       ["Keyboard" hm--html-add-keyboard t]
  182. ;       ["Command" hm--html-add-command t]
  183. ;       ["Argument" hm--html-add-argument t]
  184. ;       ["Option" hm--html-add-option t]
  185. ;       ["Variable" hm--html-add-variable t]
  186. ;       ["Instance" hm--html-add-instance t]
  187. ;       ["Code" hm--html-add-code t]
  188. ;       ["Sample" hm--html-add-sample t]
  189. ;       )
  190. ;      ("Literature"
  191. ;       ["Quote" hm--html-add-quote t]
  192. ;       ["Acronym" hm--html-add-acronym t]
  193. ;       ["Abbreviation" hm--html-add-abbreviation t]
  194. ;       ["Citation" hm--html-add-citation t]
  195. ;       ["Literature" hm--html-add-literature t]
  196. ;       ["Publication" hm--html-add-publication t]
  197. ;       ["ISBN" hm--html-add-isbn t]
  198. ;       )
  199. ;      ("Person"
  200. ;       ["Person" hm--html-add-person t]
  201. ;       ["Author" hm--html-add-author t]
  202. ;       ["Editor" hm--html-add-editor t]
  203. ;       ["Credits" hm--html-add-credits t]
  204. ;       ["Copyright" hm--html-add-copyright t]
  205. ;       )
  206. ;      "----"
  207. ;      ["Footnote" hm--html-add-footnote t]
  208. ;      ["Margin" hm--html-add-margin t]
  209. ;      "----"
  210. ;      ["HTML Comment" hm--html-add-comment t]
  211.       )
  212.      ("Include"
  213.       ["Top aligned image..." hm--html-add-image-top t]
  214.       ["Middle aligned image..." hm--html-add-image-middle t]
  215.       ["Bottom aligned image..." hm--html-add-image-bottom t]
  216.       ["Image as map? ..." hm--html-add-image t]
  217.       ["Drag & Drop"
  218.        idd-start-mouse-drag-and-drop
  219.        :active t
  220.        :keys "\\[idd-mouse-drag-and-drop]"]
  221.       "----"
  222.       ["Image map..." hm--html-add-image-map t]
  223.       ["Map..." hm--html-add-map t]
  224.       ["Area..." hm--html-add-area t]
  225.       "----"
  226.       ["Applet..." hm--html-add-applet t]
  227.       ["Parameter..." hm--html-add-applet-parameter t]
  228.       ["Script" hm--html-add-script t]
  229. ;      "----"
  230. ;      ["File..."  hm--html-add-server-side-include-file t]
  231. ;      ["Command..." hm--html-add-server-side-include-command t]
  232. ;      ["Command with isindex parameter..." 
  233. ;       hm--html-add-server-side-include-command-with-isindex-parameter
  234. ;       t]
  235.       )
  236.      ("Forms"
  237.       ["Form..." hm--html-add-form t]
  238.       "----"
  239.       ["Text field..." hm--html-form-add-input-text t]
  240.       ["Password field..." hm--html-form-add-input-password t]
  241.       ["Isindex field..." hm--html-form-add-input-isindex t]
  242.       ["Integer field..." hm--html-form-add-input-integer t]
  243.       ["Float field..." hm--html-form-add-input-float t]
  244.       ["Date field..." hm--html-form-add-input-date t]
  245.       ["Url field..." hm--html-form-add-input-url t]
  246.       ["Scribble field..." hm--html-form-add-input-scribble t]
  247.       "----"
  248.       ["Checkbox button..." hm--html-form-add-input-checkbox t]
  249.       ["Radio button..." hm--html-form-add-input-radio t]
  250.       ["Reset button..." hm--html-form-add-input-reset t]
  251.       ["Submit button..." hm--html-form-add-input-submit t]
  252.       ["Image button..." hm--html-form-add-input-image t]
  253.       ["Audio button..." hm--html-form-add-input-audio t]
  254.       "----"
  255.       ["Option Menu..." hm--html-form-add-select-option-menu t]
  256.       ["Scrolled List..." hm--html-form-add-select-scrolled-list t]
  257.       ["Option..." hm--html-form-add-select-option t]
  258.       "----"
  259.       ["Textarea..." hm--html-form-add-textarea t]
  260.       )
  261.      ))
  262.  
  263.  
  264. (setq hm--html-menu-noregion-novice
  265.        '("HTML No-region Novice Menu"
  266.      ("Anchors"
  267.       ["Relative link..." hm--html-add-relative-link t]
  268.       ["Drag & Drop"
  269.        idd-start-mouse-drag-and-drop 
  270.        :active t
  271.        :keys "\\[idd-mouse-drag-and-drop]"]
  272.       "----"
  273.       ["Html link..." hm--html-add-html-link t]
  274.       ["File link..." hm--html-add-file-link t]
  275.       )
  276.      ("Frame"
  277.       ["Full html frame..." hm--html-add-full-html-frame t]
  278.       "----"
  279.       ["Title and Header..." hm--html-add-title-and-header t]
  280.       ["Signature" hm--html-add-signature t]
  281.       )
  282.      ("Structure"
  283.       ["Menu item" hm--html-add-list-or-menu-item t]
  284.       ["Menu" hm--html-add-menu t]
  285.       "----"
  286.       ["Paragraph Container" hm--html-add-paragraph t]
  287.       )
  288.      ("Formatting Paragraphs"
  289. ;      ["Without links" hm--html-add-plaintext t]
  290.       ["Preformatted" hm--html-add-preformatted t]
  291.       )
  292.      ("Formatting Words"
  293.       ["Bold" hm--html-add-bold t]
  294.       ["Italic" hm--html-add-italic t]
  295.       ["Underline" hm--html-add-underline t]
  296.           ["Typewriter" hm--html-add-fixed t]
  297.       )))
  298.  
  299. (setq hm--html-menu-region-expert
  300.        '("HTML Region Expert Menu"
  301.      ("Anchors"
  302.       ["Relative link..." hm--html-add-relative-link-to-region t]
  303.       ["General link..." hm--html-add-normal-link-to-region t]
  304.       ["Drag & Drop"
  305.        idd-start-mouse-drag-and-drop 
  306.        :active t
  307.        :keys "\\[idd-mouse-drag-and-drop]"]
  308.       "----"
  309.       ["Html link..." hm--html-add-html-link-to-region t]
  310.       ["Info link..." hm--html-add-info-link-to-region t]
  311.       ["Gopher link..." hm--html-add-gopher-link-to-region t]
  312.       ["File link..." hm--html-add-file-link-to-region t]
  313.       "----"
  314.       ["Ftp link..." hm--html-add-ftp-link-to-region t]
  315.       ["News link..." hm--html-add-news-link-to-region t]
  316.       ["Mailbox link..." hm--html-add-mail-box-link-to-region t]
  317.       ["Mailto link..." hm--html-add-mailto-link-to-region t]
  318.       ["WAIS link (direct)..." hm--html-add-direct-wais-link-to-region t]
  319.       ["WAIS link (gateway)..." hm--html-add-wais-link-to-region t]
  320.       "----"
  321.       ["Proggate link..." hm--html-add-proggate-link-to-region t]
  322.       ["Local Proggate link..." 
  323.        hm--html-add-local-proggate-link-to-region 
  324.        t]
  325.       "----"
  326.       ["Link target..." hm--html-add-link-target-to-region t]
  327.       )
  328.      ("Frame"
  329.       ["Full html frame..." hm--html-add-full-html-frame-with-region t]
  330.       "----"
  331.       ["Head" hm--html-add-head-to-region t]
  332.       ["Body" hm--html-add-body-to-region t]
  333.       "----"
  334.       ["Title and Header..." hm--html-add-title-and-header-to-region t]
  335.       ["Title" hm--html-add-title-to-region t]
  336.       ["Header..." hm--html-add-header-to-region t]
  337.       ["Address" hm--html-add-address-to-region t]
  338.       )
  339.      ("Structure"
  340.       ["Menu item" hm--html-add-list-or-menu-item-to-region t]
  341.       ["Menu" hm--html-add-menu-to-region t]
  342.       ["Unordered list" hm--html-add-list-to-region t]
  343.       ["Ordered list" hm--html-add-numberlist-to-region t]
  344.       ["Directory list" hm--html-add-directorylist-to-region t]
  345.       "----"
  346.       ["Description list" hm--html-add-description-list-to-region t]
  347.       ["Description title" hm--html-add-description-title-to-region t]
  348.       ["Description entry" hm--html-add-description-entry-to-region t]
  349.       "----"
  350.       ["Table..." hm--html-add-table-to-region t]
  351.       ["Table Title..." hm--html-add-table-title-to-region t]
  352.       ("Additional Commands"
  353.        ["Table row frame..." hm--html-add-row-frame-to-region t]
  354.        )
  355.       "----"
  356.       ["Paragraph container" hm--html-add-paragraph-to-region t]
  357.       ["Document division" hm--html-add-document-division-to-region t]
  358.       )
  359.      ("Formatting Paragraphs"
  360. ;      ["Without links" hm--html-add-plaintext-to-region t]
  361.       ["Preformatted" hm--html-add-preformatted-to-region t]
  362.           ["Blockquote" hm--html-add-blockquote-to-region t]
  363.       "----"
  364.       ["Font..." hm--html-add-font-to-region t]
  365.       ["Center" hm--html-add-center-to-region t]
  366.       ["Style" hm--html-add-style-to-region t]
  367.       "----"
  368.       ["HTML Comment" hm--html-add-comment-to-region t]
  369. ;      ["Listing" hm--html-add-listing-to-region t]
  370. ;      ["Abstract" hm--html-add-abstract-to-region t]
  371.       )
  372.      ("Formatting Words"
  373.       ["Bold" hm--html-add-bold-to-region t]
  374.       ["Italic" hm--html-add-italic-to-region t]
  375.           ["Typewriter" hm--html-add-fixed-to-region t]
  376.       ["Small" hm--html-add-small-to-region t]
  377.       ["Big" hm--html-add-big-to-region t]
  378.       ["Superscript" hm--html-add-superscript-to-region t]
  379.       ["Subscript" hm--html-add-subscript-to-region t]
  380.       "----"
  381.       ["Underline" hm--html-add-underline-to-region t]
  382.       ["Strikethru" hm--html-add-strikethru-to-region t]
  383.       ;;      ["Render" hm--html-add-render-to-region t]
  384.       "----"
  385. ;          ["Emphasized" hm--html-add-emphasized-to-region t]
  386. ;          ["Strong" hm--html-add-strong-to-region t]
  387. ;      "----"
  388.       ("Phrase"
  389.        ["Emphasized" hm--html-add-emphasized-to-region t]
  390.        ["Strong" hm--html-add-strong-to-region t]
  391.        "----"
  392.        ["Definition" hm--html-add-definition-to-region t]
  393.        ["Keyboard" hm--html-add-keyboard-to-region t]
  394.        ["Variable" hm--html-add-variable-to-region t]      
  395.        ["Code" hm--html-add-code-to-region t]
  396.        ["Sample" hm--html-add-sample-to-region t]
  397.        ["Citation" hm--html-add-citation-to-region t]
  398.        )
  399. ;; All the following commands are still implemented, but most
  400. ;; of them are not defined in HTM 3.2
  401. ;      ("Computing"
  402. ;       ["Definition" hm--html-add-definition-to-region t]
  403. ;       ["Keyboard" hm--html-add-keyboard-to-region t]
  404. ;       ["Command" hm--html-add-command-to-region t]
  405. ;       ["Argument" hm--html-add-argument-to-region t]
  406. ;       ["Option" hm--html-add-option-to-region t]
  407. ;       ["Variable" hm--html-add-variable-to-region t]      
  408. ;       ["Instance" hm--html-add-instance-to-region t]
  409. ;       ["Code" hm--html-add-code-to-region t]
  410. ;       ["Sample" hm--html-add-sample-to-region t]
  411. ;       )
  412. ;      ("Literature"
  413. ;       ["Quote" hm--html-add-quote-to-region t]
  414. ;       ["Acronym" hm--html-add-acronym-to-region t]
  415. ;       ["Abbrevation" hm--html-add-abbrevation-to-region t]
  416. ;       ["Citation" hm--html-add-citation-to-region t]
  417. ;       ["Literature" hm--html-add-literature-to-region t]
  418. ;       ["Publication" hm--html-add-publication-to-region t]
  419. ;       ["ISBN" hm--html-add-isbn-to-region t]
  420. ;       )
  421. ;      ("Person"
  422. ;       ["Person" hm--html-add-person-to-region t]
  423. ;       ["Author" hm--html-add-author-to-region t]
  424. ;       ["Editor" hm--html-add-editor-to-region t]
  425. ;       ["Credits" hm--html-add-credits-to-region t]
  426. ;       ["Copyright" hm--html-add-copyright-to-region t]
  427. ;       )
  428. ;      "----"
  429. ;      ["Footnote" hm--html-add-footnote-to-region t]
  430. ;      ["Margin" hm--html-add-margin-to-region t]
  431. ;      "----"
  432. ;      ["HTML Comment" hm--html-add-comment-to-region t]
  433.       )
  434.      ("Include"
  435.       ["Map..." hm--html-add-map-to-region t]
  436.       "----"
  437.       ["Applet..." hm--html-add-applet-to-region t]
  438.       ["Script" hm--html-add-script-to-region t]
  439.       )
  440.      ("Forms"
  441.       ["Form..." hm--html-add-form-to-region t])
  442.      ))
  443.  
  444.  
  445. (setq hm--html-menu-region-novice
  446.       '("HTML Region Novice Menu"
  447.      ("Anchors"
  448.       ["Relative link..." hm--html-add-relative-link-to-region t]
  449.       ["Drag & Drop"
  450.        idd-start-mouse-drag-and-drop 
  451.        :active t
  452.        :keys "\\[idd-mouse-drag-and-drop]"]
  453.       "----"
  454.       ["Html link..." hm--html-add-html-link-to-region t]
  455.       ["File link..." hm--html-add-file-link-to-region t]
  456.       )
  457.      ("Frame"
  458.       ["Full html frame..." hm--html-add-full-html-frame-with-region t]
  459.       "----"
  460.       ["Title and Header..." hm--html-add-title-and-header-to-region t]
  461.       )
  462.      ("Structure"
  463.       ["Menu item" hm--html-add-list-or-menu-item-to-region t]
  464.       ["Menu" hm--html-add-menu-to-region t]
  465.       )
  466.      ("Formatting Paragraphs"
  467. ;      ["Without links" hm--html-add-plaintext-to-region t]
  468.       ["Preformatted" hm--html-add-preformatted-to-region t]
  469.       )
  470.      ("Formatting Words"
  471.       ["Bold" hm--html-add-bold-to-region t]
  472.       ["Italic" hm--html-add-italic-to-region t]
  473.       ["Underline" hm--html-add-underline-to-region t]
  474.           ["Typewriter" hm--html-add-fixed-to-region t]
  475.       )
  476.      ))
  477.  
  478.  
  479. (if (adapt-xemacsp)
  480.     ;; The reason for this if form is, that the Emacs 19 can't
  481.     ;; work correct with `:keys "\\[idd-help-mouse-drag-and-drop]"'
  482.     (setq hm--html-pulldown-menu
  483.       '("HTML Config Menu"
  484.         ("Set popup menu"
  485.          ["Novice menu" 
  486.           hm--html-use-novice-menu
  487.           :active t
  488.           :style radio
  489.           :selected (not hm--html-expert)]
  490.          ["Expert menu"
  491.           hm--html-use-expert-menu
  492.           :active t
  493.           :style radio
  494.           :selected hm--html-expert]
  495.          )
  496.         ["Reload config files" hm--html-load-config-files t]
  497.         ["Templates (fixed dirs) ..."
  498.          hm--html-insert-template-from-fixed-dirs
  499.          t]
  500.         ["Templates ..." hm--html-insert-template t]
  501.         ["Drag & Drop"
  502.          idd-start-mouse-drag-and-drop
  503.          :active t
  504.          :keys "\\[idd-mouse-drag-and-drop]"]
  505.         ["Drag & Drop Help"
  506.          idd-start-help-mouse-drag-and-drop
  507.          :active t
  508.          :keys "\\[idd-help-mouse-drag-and-drop]"]
  509.         "----"
  510.         ["Remove numeric names" hm--html-remove-numeric-names t]
  511.         ["Quotify hrefs" hm--html-quotify-hrefs t]
  512.         "----"
  513.         ["Submit bug report..." hm--html-submit-bug-report t]
  514.         ["WWW Package Docs" hm--html-view-www-package-docu t]
  515.         "----"
  516.         ("Preview Document"     
  517.          ["Netscape view buffer" (hm--html-send-buffer-to-netscape 
  518.                       (current-buffer)) t]
  519.          "----"
  520.          ["Xmosaic start" html-view-start-mosaic t]
  521.          ["Xmosaic view buffer" html-view-view-buffer t]
  522.          ["Xmosaic view file" html-view-view-file t]
  523.          ["Xmosaic goto url" html-view-goto-url t]
  524.          ["Xmosaic get display" html-view-get-display t]
  525.          "----"
  526.          ["W3 start" w3 t]
  527.          ["W3 view buffer" w3-preview-this-buffer t]
  528.          ["W3 open remote file..." w3-fetch t]
  529.          ["W3 open local..." w3-open-local t]
  530.          ["W3 use hotlist..." w3-use-hotlist t]
  531.          )
  532.         ))
  533.   (setq hm--html-pulldown-menu
  534.     '("HTML Config Menu"
  535.       ("Set popup menu"
  536.        ["Novice menu" 
  537.         hm--html-use-novice-menu
  538.         :active t
  539.         :style radio
  540.         :selected (not hm--html-expert)]
  541.        ["Expert menu"
  542.         hm--html-use-expert-menu
  543.         :active t
  544.         :style radio
  545.         :selected hm--html-expert]
  546.        )
  547.       ["Reload config files" hm--html-load-config-files t]
  548.       ["Templates (fixed dirs) ..."
  549.        hm--html-insert-template-from-fixed-dirs
  550.        t]
  551.       ["Templates ..." hm--html-insert-template t]
  552.       ["Drag & Drop"
  553.        idd-start-mouse-drag-and-drop
  554.        :active t]
  555.       ["Drag & Drop Help"
  556.        idd-start-help-mouse-drag-and-drop
  557.        :active t]
  558.       "----"
  559.       ["Remove numeric names" hm--html-remove-numeric-names t]
  560.       ["Quotify hrefs" hm--html-quotify-hrefs t]
  561.       "----"
  562.       ["Submit bug report..." hm--html-submit-bug-report t]
  563.       ["WWW Package Docs" hm--html-view-www-package-docu t]
  564.       "----"
  565.       ("Preview Document"     
  566.        ["Netscape view buffer" (hm--html-send-buffer-to-netscape 
  567.                     (current-buffer)) t]
  568.        "----"
  569.        ["Xmosaic start" html-view-start-mosaic t]
  570.        ["Xmosaic view buffer" html-view-view-buffer t]
  571.        ["Xmosaic view file" html-view-view-file t]
  572.        ["Xmosaic goto url" html-view-goto-url t]
  573.        ["Xmosaic get display" html-view-get-display t]
  574.        "----"
  575.        ["W3 start" w3 t]
  576.        ["W3 view buffer" w3-preview-this-buffer t]
  577.        ["W3 open remote file..." w3-fetch t]
  578.        ["W3 open local..." w3-open-local t]
  579.        ["W3 use hotlist..." w3-use-hotlist t]
  580.        )
  581.       ))
  582.   )    
  583.  
  584. (if (adapt-xemacsp)
  585.     (defun hm--install-html-menu (menu-name)
  586.       (if (and (featurep 'menubar)
  587.            current-menubar (not (assoc menu-name current-menubar)))
  588.       (progn
  589.         (set-buffer-menubar (copy-sequence current-menubar))
  590.         (add-submenu nil
  591.              (cons menu-name (cdr hm--html-pulldown-menu))
  592.              "HTML"))))
  593.  
  594.   (defun hm--install-html-menu (menu-name)
  595.     (if (eq major-mode 'hm--html-mode)
  596.     (easy-menu-define hm--html-menu-map
  597.               hm--html-mode-map
  598.               "The hm--html-mode pulldown menu."
  599.               (cons menu-name
  600.                 (cdr hm--html-pulldown-menu)))
  601.       (easy-menu-define hm--html-minor-menu-map
  602.             hm--html-minor-mode-map
  603.             "The hm--html-minor-mode pulldown menu."
  604.             (cons menu-name
  605.                   (cdr hm--html-pulldown-menu))))
  606.     ))
  607.  
  608. (if (adapt-emacs19p)
  609.     (progn
  610.  
  611.       (setq hm--html-menu-noregion-expert-map
  612.           (make-lucid-menu-keymap (car hm--html-menu-noregion-expert)
  613.                       (cdr hm--html-menu-noregion-expert)))
  614.  
  615.       (setq hm--html-menu-region-expert-map
  616.         (make-lucid-menu-keymap (car hm--html-menu-region-expert)
  617.                     (cdr hm--html-menu-region-expert)))
  618.  
  619.       (setq hm--html-menu-noregion-novice-map
  620.         (make-lucid-menu-keymap (car hm--html-menu-noregion-novice)
  621.                     (cdr hm--html-menu-noregion-novice)))
  622.  
  623.       (setq hm--html-menu-region-novice-map
  624.         (make-lucid-menu-keymap (car hm--html-menu-region-novice)
  625.                     (cdr hm--html-menu-region-novice)))
  626.  
  627.       ;; Speeds up the first popup of a menu
  628.       (if hm--html-expert
  629.       (progn
  630.         (x-popup-menu nil hm--html-menu-noregion-expert-map)
  631.         (x-popup-menu nil hm--html-menu-region-expert-map)
  632.         )
  633.     (x-popup-menu nil hm--html-menu-noregion-novice-map)
  634.     (x-popup-menu nil hm--html-menu-region-novice-map))
  635.  
  636.  
  637.       )
  638.  
  639.   (defun hm--html-popup-menu (event)
  640.     "Pops the HTML- menu up, if no region is active."
  641.     (interactive "@e")
  642.     (if hm--html-expert
  643.     (popup-menu hm--html-menu-noregion-expert)
  644.       (popup-menu hm--html-menu-noregion-novice)))
  645.  
  646.  
  647.   (defun hm--html-popup-menu-region (event)
  648.     "Pops the HTML- menu up, if a region is active."
  649.     (interactive "@e")
  650.     (if hm--html-expert
  651.     (popup-menu hm--html-menu-region-expert)
  652.       (popup-menu hm--html-menu-region-novice)))
  653.   )
  654.  
  655.  
  656. (if (adapt-xemacsp)
  657.     (progn
  658.  
  659.       (defun hm--html-use-novice-menu ()
  660.     "Changes the HTML popup menu to the novice menu."
  661.     (interactive)
  662.     (setq hm--html-expert nil)
  663.     )    
  664.  
  665.  
  666.       (defun hm--html-use-expert-menu ()
  667.     "Changes the HTML popup menu to the expert menu."
  668.     (interactive)
  669.     (setq hm--html-expert t)
  670.     )
  671.       )
  672.  
  673.   ;; For the Emacs 19
  674.   (defun hm--html-use-novice-menu ()
  675.     "Changes the HTML popup menu to the novice menu."
  676.     (interactive)
  677.     (setq hm--html-expert nil)
  678.     (define-key hm--html-region-mode-map
  679.       hm--html-emacs19-popup-region-menu-button
  680.       hm--html-menu-region-novice-map)
  681.     (define-key hm--html-minor-region-mode-map
  682.       hm--html-emacs19-popup-region-menu-button
  683.       hm--html-menu-region-novice-map)
  684.     (if (not hm--html-region-mode)
  685.     (define-key hm--html-mode-map
  686.       hm--html-emacs19-popup-noregion-menu-button
  687.       hm--html-menu-noregion-novice-map))
  688.     (if (not hm--html-minor-region-mode)
  689.     (define-key hm--html-minor-mode-map 
  690.       hm--html-emacs19-popup-noregion-menu-button
  691.       hm--html-menu-noregion-novice-map))
  692.     )
  693.  
  694.   (defun hm--html-use-expert-menu ()
  695.     "Changes the HTML popup menu to the expert menu."
  696.     (interactive)
  697.     (setq hm--html-expert t)
  698.     (define-key hm--html-region-mode-map
  699.       hm--html-emacs19-popup-region-menu-button
  700.       hm--html-menu-region-expert-map)
  701.     (define-key hm--html-minor-region-mode-map
  702.       hm--html-emacs19-popup-region-menu-button 
  703.       hm--html-menu-region-expert-map)
  704.     (if (not hm--html-region-mode)
  705.     (define-key hm--html-mode-map
  706.       hm--html-emacs19-popup-noregion-menu-button
  707.       hm--html-menu-noregion-expert-map))
  708.     (if (not hm--html-minor-region-mode)
  709.     (define-key hm--html-minor-mode-map 
  710.       hm--html-emacs19-popup-noregion-menu-button
  711.       hm--html-menu-noregion-expert-map))
  712.     )
  713.   )
  714.  
  715.  
  716. (defvar hm--html-use-psgml t
  717.   "Set this to t, if functions from the psgml-mode should be used.")
  718.  
  719. ;;; Popup the menus in the minor mode
  720.  
  721. (if (adapt-xemacsp)
  722.     (progn
  723.  
  724.       (defadvice sgml-xemacs-get-popup-value (around
  725.                           hm--html-popup-menu-advice
  726.                           activate)
  727.     "Calls `hm--html-sgml-xemacs-get-popup-value' instead of the original.
  728. `hm--html-sgml-xemacs-get-popup-value' is only called, if the
  729. `hm--html-minor-mode' is active. 
  730. `hm--html-sgml-xemacs-get-popup-value' adds the 'hm--html-mode' popup
  731. menus to the psgml popup menu."
  732.     (if hm--html-minor-mode
  733.         (setq ad-return-value
  734.           (hm--html-sgml-xemacs-get-popup-value (ad-get-arg 0)))
  735.       ad-do-it))
  736.       
  737.       (defun hm--html-sgml-xemacs-get-popup-value (menudesc)
  738.     (let ((value nil)
  739.           (event nil))
  740.       ;; (popup-menu menudesc)
  741.       (popup-menu (append hm--html-popup-menu  ; for the hm--html-menu 
  742.                   (list "=="           ;
  743.                     (car menudesc) ;
  744.                     "==")          ;
  745.                   (cdr menudesc)))     ;
  746.       (while (popup-up-p)
  747.         (setq event (next-command-event event))
  748.         (cond ((misc-user-event-p event)
  749.            (cond
  750.             ((eq (event-object event) 'abort)
  751.              (signal 'quit nil))
  752.             ((eq (event-object event) 'menu-no-selection-hook)
  753.              nil)
  754.             ((commandp (event-object event))            ; for the 
  755.              (set-mark hm--html-mark)            ;
  756.              (goto-char hm--html-point)            ;
  757.              (call-interactively (event-object event))  ; hm--html-menu
  758.              (signal 'quit nil))                        ; items
  759.             (t
  760.              (eval (event-object event)))))
  761.           ((button-release-event-p event) ; don't beep twice
  762.            nil)
  763.           ((and (fboundp 'event-matches-key-specifier-p)
  764.             (event-matches-key-specifier-p event (quit-char)))
  765.            (signal 'quit nil))
  766.           (t
  767.            (beep)
  768.            (message "please make a choice from the menu."))))
  769.       value))
  770.       )
  771.  
  772.   ;; For the Emacs 19
  773.   (defun hm--html-add-major-menu-to-minor-menus ()
  774.     "Adds an entry to get the general major menu in the minor mode menus.
  775. This function is only used in the Emacs 19."
  776.     (define-key  hm--html-menu-noregion-novice-map
  777.       [mouse-major-mode-menu]
  778.       '("Major Mode Menu" . mouse-major-mode-menu))
  779.     (define-key  hm--html-menu-noregion-expert-map
  780.       [mouse-major-mode-menu]
  781.       '("Major Mode Menu" . mouse-major-mode-menu))
  782.     (define-key  hm--html-menu-region-novice-map
  783.       [mouse-major-mode-menu]
  784.       '("Major Mode Menu" . mouse-major-mode-menu))
  785.     (define-key  hm--html-menu-region-expert-map
  786.       [mouse-major-mode-menu]
  787.       '("Major Mode Menu" . mouse-major-mode-menu)))
  788.  
  789.   (defun hm--html-remove-major-menu-from-minor-menus ()
  790.     "Removes the entry to get the general major menu in the minor mode menus.
  791. This function is only used in the Emacs 19."
  792.     (define-key  hm--html-menu-noregion-novice-map
  793.       [mouse-major-mode-menu] 'undefined)
  794.     (define-key  hm--html-menu-noregion-expert-map
  795.       [mouse-major-mode-menu] 'undefined)
  796.     (define-key  hm--html-menu-region-novice-map
  797.       [mouse-major-mode-menu] 'undefined)
  798.     (define-key  hm--html-menu-region-expert-map
  799.       [mouse-major-mode-menu] 'undefined))
  800.   )
  801.  
  802. (if (adapt-xemacsp)
  803.     (progn
  804.  
  805.       (defun hm--html-popup-minor-html-menu (event)
  806.     "Pops the HTML- menu up, if no region is active."
  807.     (interactive "@e")
  808.     (if (eq major-mode 'html-mode)
  809.         (if hm--html-use-psgml
  810.         (let ((hm--html-popup-menu (if hm--html-expert
  811.                            hm--html-menu-noregion-expert
  812.                          hm--html-menu-noregion-novice))
  813.               (hm--html-point (point))
  814.               (hm--html-mark (mark)))
  815.           (sgml-tags-menu event))
  816.           (if hm--html-expert
  817.           (popup-menu hm--html-menu-noregion-expert)
  818.         (popup-menu hm--html-menu-noregion-novice))
  819.           )
  820.       (popup-menu (append  ;mode-popup-menu
  821.                    ;'("===")
  822.                    (if hm--html-expert
  823.                    hm--html-menu-noregion-expert
  824.                  hm--html-menu-noregion-novice)
  825.                    (list "==="
  826.                      (car mode-popup-menu)
  827.                      "===")
  828.                    (cdr mode-popup-menu)
  829.                    ))))
  830.         
  831.       
  832.       
  833.       (defun hm--html-popup-minor-html-menu-region (event)
  834.     "Pops the HTML- menu up, if a region is active."
  835.     (interactive "@e")
  836.     (if (eq major-mode 'html-mode)
  837.         (if hm--html-use-psgml
  838.         (let ((hm--html-popup-menu (if hm--html-expert
  839.                            hm--html-menu-region-expert
  840.                          hm--html-menu-region-novice))
  841.               (hm--html-point (point))
  842.               (hm--html-mark (mark)))
  843.           (sgml-tags-menu event))
  844.           (if hm--html-expert
  845.           (popup-menu hm--html-menu-region-expert)
  846.         (popup-menu hm--html-menu-region-novice))
  847.           )
  848.       (popup-menu (append  mode-popup-menu
  849.                    '("---")
  850.                    (if hm--html-expert
  851.                    hm--html-menu-noregion-expert
  852.                  hm--html-menu-noregion-novice)))))
  853.       
  854.       ))
  855.  
  856.  
  857. (run-hooks 'hm--html-menu-load-hook)
  858.  
  859.  
  860. ;;; Announce the feature hm--html-menu
  861. (provide 'hm--html-menu)
  862.